//
//  LXNoHighLightViewCell.m
//  LvXi_newVersion
//
//  Created by 诸葛孔明 on 16/8/11.
//  Copyright © 2016年 SJT. All rights reserved.
//

#import "LXNoHighLightViewCell.h"
@interface LXNoHighLightViewCell()
@property(nonatomic,strong)UIView * line;
@end
@implementation LXNoHighLightViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        UIImageView * backgroundImage = [[UIImageView alloc] initWithFrame:CGRectMake(globalMargin, 0, ScreenWidth-2*globalMargin, MineRatio(40))];
        backgroundImage.image = [UIImage imageNamed:@"brokerage_bg02"];
        backgroundImage.transform = CGAffineTransformRotate(backgroundImage.transform , M_PI);
        [self.contentView insertSubview:backgroundImage atIndex:0];
        self.backgroundImageView = backgroundImage;
        
        
        UIView * line = [[UIView alloc] initWithFrame:CGRectMake(2*globalMargin, MineRatio(40)-1, ScreenWidth-4*globalMargin, 0.5)];
        line.backgroundColor = HexColor(@"#EEEEEE");
        self.line = line;
        [self.contentView addSubview:line];
    }
    return self;
}



-(void)setBackgroundImageViewHeight:(CGFloat)height{
    self.backgroundImageView.height = height;
    self.line.y = height-1;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    self.imageView.x = 2*globalMargin;
    self.line.x = 2*globalMargin;
//    self.textLabel.x = 20;
}

-(void)setRoundStyle:(RoundStyle)roundStyle{
    _roundStyle = roundStyle;
    self.backgroundImageView.transform = CGAffineTransformIdentity;
    [self.backgroundImageView addRadius:0];
    switch (_roundStyle) {
        case RoundStyleTop:{
            self.backgroundImage = [UIImage imageNamed:@"brokerage_bg02"];
            self.backgroundImageView.transform = CGAffineTransformRotate(self.backgroundImageView.transform, M_PI);
        }break;
        case RoundStyleBottom:{
            self.backgroundImage = [UIImage imageNamed:@"brokerage_bg02"];
        }break;
        case RoundStyleAll:{
            self.backgroundImage = [UIImage imageWithColor:[UIColor whiteColor] size:self.backgroundImageView.size];
            [self.backgroundImageView addRadius:10];
        }break;
        case RoundStyleNone:{
            self.backgroundImage = [UIImage imageWithColor:[UIColor whiteColor] size:self.backgroundImageView.size];
            [self.backgroundImageView addRadius:0];
        }break;
        default:
            break;
    }
}

-(void)setEnableUnaderLine:(BOOL)enableUnaderLine{
    _enableUnaderLine = enableUnaderLine;
    self.line.hidden = !_enableUnaderLine;
}

-(void)setBackgroundImage:(UIImage *)backgroundImage{
    _backgroundImage = backgroundImage;
    self.backgroundImageView.image = backgroundImage;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
//    [super setSelected:selected animated:animated];

}

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
    
}

@end
